dofile(os.getenv('LUAR_HOME') .. '/util/File.lua')
local oo = require "loop.base";


ScriptInvoker = oo.class{};

function ScriptInvoker:invoke(command)
	if command == nil or command.scriptName == nil then
		print("Problem when trying to invoke command\nFails to perform operation");
		exit(1);
	end
	local file = File{}
        if file:exists( os.getenv('LUAR_HOME') .."/scripts/"..command.scriptName  ) then
		dofile(os.getenv("LUAR_HOME").."/scripts/"..command.scriptName);
		if execute() == true then
			print("Operation performed successfully");
		else
			print("Fails to perform operation")
		end
	else
		print("Problem when trying to invoke command\nScript not found, fails to perform operation.");
	end
end
